﻿(function () {
    var saveCmd =
	{
	    modes: { wysiwyg: 1, source: 1 },
	    canUndo: false,
	    readOnly: 1,

	    exec: function (editor) {
	        
	        try {
	            SaveData(true);
	            //window.external.FocusChanged('');
	        }
	        catch (e) {

	        }
	    }
	};
    var pluginName = 'savetoel';
    CKEDITOR.plugins.add(pluginName,
	{
	    init: function (editor) {
	        var command = editor.addCommand(pluginName, saveCmd);
	        command.modes = { wysiwyg: !!(editor.element.$) };

	        editor.ui.addButton('SaveToEl',
				{
				    label: '预览',
				    icon: this.path + 'preview.png',
				    command: pluginName
				});
	    }
	});
})();
